package com.example.xianji.adapter;

import java.util.ArrayList;

import com.example.xianji.R;
import com.example.xianji.bean.Collection;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class QiYe_detail_Adapter extends BaseAdapter {
    private Context mContext;
    private ArrayList<Collection> list;


    public QiYe_detail_Adapter(Context mContext, ArrayList<Collection> list) {
        super();
        this.mContext = mContext;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        Holder mHolde = null;
        if (convertView == null) {
            mHolde = new Holder();
            convertView = View.inflate(mContext, R.layout.qiye_detail_item, null);
            mHolde.qiye_fuwu_title = (TextView) convertView.findViewById(R.id.qiye_fuwu_title);
            mHolde.qiye_fuwu_detail = (TextView) convertView.findViewById(R.id.qiye_fuwu_detail);

            convertView.setTag(mHolde);
        }
        mHolde = (Holder) convertView.getTag();
        mHolde.qiye_fuwu_title.setText(list.get(position).getTitle());
        mHolde.qiye_fuwu_detail.setText(list.get(position).getDetail());
        final int a = position;

        return convertView;
    }

    class Holder {
        TextView qiye_fuwu_title, qiye_fuwu_detail;
    }
}
